package com.xju.controller.book;

import com.xju.common.utils.JSONUtil;
import com.xju.service.impl.BookServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/book/delete")
public class BookDelServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取参数
        req.setCharacterEncoding("utf-8");
        String bookID = req.getParameter("bookID");
        //调用service
        BookServiceImpl bookService = new BookServiceImpl();
        bookService.delete(bookID);
        JSONUtil.printByJSON(resp,true);
    }
}
